<include file="public@header"/>
</head>
<style>
    /*tr td input,tr td select{ max-width:100px;width:auto;}*/
</style>
<body>
<div class="wrap">
    <ul class="nav nav-tabs">
        <li><a href="{:url('file/index')}">档案管理</a></li>
        <li><a href="{:url('file/add')}">档案添加</a></li>
        <li class="active"><a href="{:url('file/edit',array('id'=>$id))}">档案编辑</a></li>
    </ul>
    <form class="form-horizontal js-ajax-form" action="{:url('file/edit_post')}" method="post">
        <fieldset>
            <input type="hidden" name="id" value="{$id}">
            <div class="p_title">
                <span class="span_title">订单详情</span>
            </div>
            <div class="control-group1-p"
                 style="border:1px solid #e2e2e2; padding-top:20px;margin:0 20px;overflow:hidden; overflow-x:auto;">

                <table class="table table-hover table-bordered">
                    <thead>
                    <tr>
                        <th>档案号</th>
                        <th>墓位编号</th>
                        <th>所在区域</th>
                        <th>具体位置</th>
                        <th>销售价格</th>
                        <th>折扣让利</th>
                        <th>类型</th>
                        <th>成交时间</th>
                        <th>成交价格</th>
                        <th>导购员</th>
                        <th>代理商/业务员</th>
                        <th>抵顶人</th>
                        <th>经办人</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr>
                        <td><input type="text" class="form-control" name="file_num" value="{$file_num}"
                                   style="width: 80px"
                                   required></td>
                        <td><input type="text" class="form-control" name="tomb_num" value="{$tomb_num}"
                                   style="width: 80px">
                        </td>
                        <td><input type="text" class="form-control" name="tomb_region" value="{$tomb_region}"
                                   style="width: 280px; height: 34px"></input></td>
                        <td><input type="text" class="form-control" name="tomb_address" value="{$tomb_address}"
                                   style="width: 280px; height: 34px"></input></td>
                        <td><input type="text" class="form-control" name="sell_price" value="{$sell_price}"
                                   style="width: 70px">
                        </td>
                        <td><input type="text" class="form-control" name="discount" value="{$discount}"
                                   style="width: 70px">
                        </td>
                        <td>
                            <select name="tomb_type" class="form-control">
                                <option value="1"
                                <if condition="$tomb_type eq '1'">selected</if>
                                >商品墓</option>
                                <option value="2"
                                <if condition="$tomb_type eq '2'">selected</if>
                                >艺术墓</option>
                                <option value="3"
                                <if condition="$tomb_type eq '3'">selected</if>
                                >壁葬</option>
                            </select>
                        </td>
                        <td><input type="text" class="form-control js-date" name="closing_time"  autocomplete="off"
                                   value="{$closing_time|date='Y-m-d'}"
                                   style="width: 105px"></td>
                        <td><input type="text" class="form-control" name="closing_price" value="{$closing_price}"
                                   style="width: 80px"></td>
                        <td><input type="text" class="form-control" name="shoppingguide" value="{$shoppingguide}"
                                   style="width: 80px"></td>
                        <td>
                            <select name="agent_user" class="form-control">
                                <volist name="deptPer" id="vo">
                                    <option value="{$vo.id}"
                                    <if condition="$agent_user eq $vo.id">selected</if>
                                    >{$vo.department_name}-{$vo.user_nickname}</option>
                                </volist>
                            </select>
                        </td>
                        <td><input type="text" class="form-control" name="reaching" value="{$reaching}"
                                   style="width: 80px">
                        </td>
                        <td><input type="text" class="form-control"
                                   value="{$user_name}" readonly style="width: 80px"></td>
                    </tr>
                    </tbody>
                </table>
            </div>
            <div class="p_title">
                <span class="span_title">购买人信息</span>
            </div>
            <div class="control-group1-p"
                 style="border:1px solid #e2e2e2; padding-top:20px;margin:0 20px;overflow:hidden; overflow-x:auto;">

                <table class="table table-hover table-bordered">
                    <thead>
                    <tr>
                        <th>客户账户</th>
                        <th>购买人姓名</th>
                        <th>联系电话</th>
                        <th>证件类型</th>
                        <th>身份证号</th>
                        <th>证件上传</th>
                        <th>联系地址</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr>
                        <td><input type="text" class="form-control" name="customer_account" value="{$customer_account}"
                                   style="width: 120px"></td>
                        <td><input type="text" class="form-control" name="customer_name" value="{$customer_name}"
                                   style="width: 100px"></td>
                        <td><input type="text" class="form-control" name="customer_phone" value="{$customer_phone}"
                                   style="width: 120px"></td>
                        <td>
                            <select name="cart_type" class="form-control">
                                <option value="1"
                                <if condition="$cart_type eq 1">selected</if>
                                >身份证</option>
                                <option value="2"
                                <if condition="$cart_type eq 2">selected</if>
                                >护照</option>
                            </select>
                        </td>
                        <td><input type="text" class="form-control" name="cart_ID" value="{$cart_ID}"
                                   style="width: 210px"></td>
                        <td>
                            <div class="btn btn-primary" id="check_btn">拍照上传</div>
                        </td>
                        <td><input type="text" class="form-control" name="contact_address" value="{$contact_address}"
                                   style="width: 350px; height: 34px"></input></td>
                    </tr>
                    </tbody>
                </table>
            </div>
            <div class="p_title">
                <span class="span_title">逝者信息</span>
            </div>
            <div class="control-group1-p"
                 style="border:1px solid #e2e2e2; padding-top:20px;margin:0 20px;overflow:hidden; overflow-x:auto;">
                <table class="table table-hover table-bordered">
                    <thead>
                    <tr>
                        <th>逝者姓名</th>
                        <th>性别</th>
                        <th>出生日期</th>
                        <th>逝世日期</th>
                        <th>落葬日期</th>
                        <th>落葬时间</th>
                        <th>收敛形式</th>
                        <th>类型</th>
                        <th>接待人</th>
                        <th>持证人与使用人关系</th>
                        <th>火化证明</th>
                    </tr>
                    </thead>
                    <tbody>
                    <foreach name="deceased" item="vo">
                        <input type="hidden" name="de_id[]" value="{$vo.id}">
                        <tr>
                            <td><input type="text" class="form-control" name="deceased_name[]"
                                       value="{$vo.deceased_name}"
                                       style="width: 100px"></td>
                            <td><select name="gender[]" class="form-control" style="width: 70px">
                                <option value="1"
                                <if condition="$vo.gender eq 1">selected</if>
                                >男</option>
                                <option value="2"
                                <if condition="$vo.gender eq 2">selected</if>
                                >女</option>
                            </select>
                            </td>
                            <td><input type="text" class="form-control js-date" name="date_birth[]" autocomplete="off"
                                       value="{$vo.date_birth|date='Y-m-d'}"
                                       style="width: 105px"></td>
                            <td><input type="text" class="form-control js-date " name="date_death[]" autocomplete="off"
                                       value="{$vo.date_death|date='Y-m-d'}"
                                       style="width: 105px"></td>
                            <td><input type="text" class="form-control js-date" name="date_funeral[]" autocomplete="off"
                                       value="{$vo.date_funeral|date='Y-m-d'}"
                                       style="width: 105px"></td>
                            <td><input type="text" class="form-control js-datetime" name="funeral_time[]" autocomplete="off"
                                       value="{$vo.funeral_time|date='Y-m-d h:m:s'}"
                                       style="width: 168px"></td>
                            <td>
                                <select name="convergence_type[]" class="form-control">
                                    <option value="1"
                                    <if condition="$vo.convergence_type eq 1">selected</if>
                                    >骨灰</option>
                                    <option value="2"
                                    <if condition="$vo.convergence_type eq 2">selected</if>
                                    >骨殖</option>
                                </select>
                            </td>
                            <td><select name="type[]" class="form-control" style="width: 120px">
                                <option value="1"
                                <if condition="$vo.type eq 1">selected</if>
                                >首位安葬</option>
                                <option value="2"
                                <if condition="$vo.type eq 2">selected</if>
                                >合葬</option>
                            </select>
                            </td>
                            <td><input type="text" class="form-control" name="receptionist[]" value="{$vo.receptionist}"
                                       style="width: 105px"></td>
                            <td><input type="text" class="form-control" name="relationship_users[]"
                                       value="{$vo.relationship_users}"
                                       style="width: 160px"></td>
                            <td>
                                <div class="btn btn-primary" id="btn1">拍照上传</div>
                            </td>
                        </tr>
                    </foreach>
                    </tbody>
                </table>
                <div class="btn btn-primary" id="">添加碑文</div>
            </div>
        </fieldset>
        <div class="form-actions">
            <input type="hidden" name="id" value="{$id}"/>
            <button type="submit" class="btn btn-primary js-ajax-submit">{:lang('SAVE')}</button>
            <a class="btn" href="javascript:history.back(-1);">{:lang('BACK')}</a>
        </div>
    </form>
</div>
<script type="text/javascript" src="__STATIC__/js/admin.js?v={:time()}"></script>
<script type="text/javascript" src="__STATIC__/js/layer/layer.js"></script>
<script type="text/javascript">

    function closing_price(obj) {
        //先把非数字的都替换掉，除了数字和.
        obj.value = obj.value.replace(/[^\d.]/g, "");
        //必须保证第一个为数字而不是.
        obj.value = obj.value.replace(/^\./g, "");
        //保证只有出现一个.而没有多个.
        obj.value = obj.value.replace(/\.{2,}/g, ".");
        //保证.只出现一次，而不能出现两次以上
        obj.value = obj.value.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
        //保证 数字整数位不大于8位
        if (100000000 <= parseFloat(obj.value))
            obj.value = "";
    }

</script>
</body>
</html>